<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.jiadakeji.ppm.modules.sys.utils.*" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>车辆管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/business/car/">车辆列表</a></li>
		<shiro:hasPermission name="business:car:edit"><li><a href="${ctx}/business/car/form">车辆添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="car" action="${ctx}/business/car/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>小区：</label>
				<form:select path="room.communityId" class="input-xlarge ">
					<form:option value="" label="请选择"/>
					<form:options items="${fns:getCommunityList()}" itemLabel="name" itemValue="id" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>楼栋：</label>
                <input type="hidden" name="hidden_buildingId" value="${car.room.buildingId}"/>
				<form:select path="room.buildingId" class="input-medium">
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			<li><label>房屋号：</label>
				<form:input path="room.code" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>车辆编号：</label>
				<form:input path="code" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>小区</th>
				<th>楼栋</th>
				<th>房屋</th>
				<th>车辆编号</th>
				<th>车辆类型价格</th>
				<th>状态</th>
				<th>update_date</th>
				<shiro:hasPermission name="business:car:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="car">
			<tr>
				<td>
					${car.room.building.community.name}
				</td>
				<td>
					${car.room.building.name}
				</td>
				<td>
					${car.room.code}
				</td>
				<td>
					${car.code}
				</td>
				<td>
					${car.carTypePrice.name}
				</td>
				<td>
					${fns:getDictLabel(car.status,"car_status" ,"" )}
				</td>
				<td>
					<fmt:formatDate value="${car.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<shiro:hasPermission name="business:car:edit"><td>
    				<a href="${ctx}/business/car/form?id=${car.id}">修改</a>
					<a href="${ctx}/business/car/delete?id=${car.id}" onclick="return confirmx('确认要删除该车辆吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<script src="${pageContext.request.contextPath}/static/common/list_relate.js"></script>
	<script>
        jQuery(function($) {
            // 选择联动
            var parameter = {
                url : "/a/business/building/getBuildingList",
                key : "communityId",
                // dataList:"schoolList",
                value : "id",
                text : "name",
                selectedVal : ""
            };
            $("select[name='room.communityId']").ajaxRelate(
                $("select[name='room.buildingId']"), parameter);
            $("select[name='room.buildingId']").val($("input[name='hidden_buildingId']").val()).trigger("change");


        });
	</script>
</body>
</html>